.\"	@(#)ttyname.3	6.1 (Berkeley) 5/15/85
.\"
.TH TTYNAME 3  "May 15, 1985"
.AT 3
.SH NAME
ttyname, isatty, ttyslot \- find name of a terminal
.SH SYNOPSIS
.B char *ttyname(filedes)
.PP
.B isatty(filedes)
.PP
.B ttyslot()
.SH DESCRIPTION
.I Ttyname
returns a pointer to the null-terminated path name
of the terminal device associated with file descriptor
.I filedes
(this is a system file descriptor and has nothing to do with the
standard I/O FILE typedef).
.PP
.I Isatty
returns 1 if
.I filedes
is associated with a terminal device, 0 otherwise.
.PP
.I Ttyslot
returns the number of the entry in the
.IR ttys (5)
file for the control terminal of the current process.
.SH FILES
/dev/\(**
.br
/etc/ttys
.SH SEE ALSO
ioctl(2), ttys(5)
.SH DIAGNOSTICS
.I Ttyname
returns a null pointer (0) if
.I filedes
does not describe a terminal device in directory `/dev'.
.PP
.I Ttyslot
returns 0 if `/etc/ttys' is inaccessible or if
it cannot determine the control terminal.
.SH BUGS
The return value points to static data
whose content is overwritten by each call.
